/*
 * SoftwareSAR - 1.0
 */
package br.com.cpqd.ssar.gerenciador.gui;

import br.com.cpqd.ssar.gerenciador.GerenciamentoNucleo;
import br.com.cpqd.ssar.mediador.gui.*;
import br.com.cpqd.ssar.utilitarias.AtributosGeometria;
import br.com.cpqd.ssar.utilitarias.DominioComputacional;
import br.com.cpqd.ssar.utilitarias.Geometria;
import br.com.cpqd.ssar.utilitarias.Material;
import java.util.Vector;

/**
 * Janela de Atribuição de Material
 * @author  Rafael Buck
 * @version 1.0
 */
public class JanelaDominioComputacional extends javax.swing.JDialog {

    /**
     * Controlador de Janelas
     */
    ControladorJanelas controladorJanelas;
    private GerenciamentoNucleo managementCore;

    /**
     * Método Construtor
     * @param controladorJanelas ControladorJanelas
     * @param parent Frame
     * @param modal determina se a janela é modal ou não (impede o acesso as janelas abaixo)
     */
    public JanelaDominioComputacional(GerenciamentoNucleo core, java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        btnLimpar.doClick();
        managementCore = core;


        txtXi.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getFirsPoint()[0]));
        txtYi.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getFirsPoint()[1]));
        txtZi.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getFirsPoint()[2]));

        txtXf.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getSecondPoint()[0]));
        txtYf.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getSecondPoint()[1]));
        txtZf.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getSecondPoint()[2]));

        
        jtxtSx.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getDiscretizacaoX()));
        jtxtSy.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getDiscretizacaoY()));
        jtxtSz.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getDiscretizacaoZ()));
        
        txtPassosTempo.setText(String.valueOf(managementCore.getDominioComputacional().getAtributos().getNSteps()));
        
        
        if (managementCore.getDominioComputacional().getMaterial().getNome() != null) {
            txtMaterial.setText(managementCore.getDominioComputacional().getMaterial().getNome());
            this.material = managementCore.getDominioComputacional().getMaterial();
        }

        if (managementCore.getDominioComputacional().isVisible()) {
            jChkVisivel.setSelected(true);
        } else {
            jChkVisivel.setSelected(false);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtXi = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtXf = new javax.swing.JTextField();
        txtYf = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtYi = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtZi = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtZf = new javax.swing.JTextField();
        jChkVisivel = new javax.swing.JCheckBox();
        txtMaterial = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        btnLocMaterial = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jtxtSx = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jtxtSy = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jtxtSz = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        txtPassosTempo = new javax.swing.JTextField();
        btnConfirmar = new javax.swing.JButton();
        btnLimpar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Atribuir Material");
        setAlwaysOnTop(true);
        setLocationByPlatform(true);
        setModal(true);
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(231, 240, 250));

        jPanel2.setBackground(new java.awt.Color(231, 240, 250));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Domínio Computacional"));

        jLabel1.setText("Xi:");

        txtXi.setPreferredSize(new java.awt.Dimension(60, 20));

        jLabel8.setText("Xf:");

        txtXf.setPreferredSize(new java.awt.Dimension(60, 20));

        txtYf.setPreferredSize(new java.awt.Dimension(60, 20));

        jLabel7.setText("Yf:");

        txtYi.setPreferredSize(new java.awt.Dimension(60, 20));

        jLabel2.setText("Yi:");

        jLabel4.setText("Zi:");

        txtZi.setPreferredSize(new java.awt.Dimension(60, 20));

        jLabel6.setText("Zf:");

        txtZf.setPreferredSize(new java.awt.Dimension(60, 20));

        jChkVisivel.setBackground(new java.awt.Color(231, 240, 250));
        jChkVisivel.setText("Visível");

        txtMaterial.setEditable(false);
        txtMaterial.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        jLabel9.setText("Material:");

        btnLocMaterial.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/folder_explore.png"))); // NOI18N
        btnLocMaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLocMaterialActionPerformed(evt);
            }
        });

        jLabel3.setText("Discretização em X:");

        jLabel10.setText("Discretização em Y:");

        jLabel11.setText("Discretização em Z:");

        jtxtSz.setPreferredSize(new java.awt.Dimension(60, 20));

        jLabel15.setText("Passos de Tempo:");

        txtPassosTempo.setPreferredSize(new java.awt.Dimension(60, 20));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(txtXi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addContainerGap()
                                        .addComponent(jLabel4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(txtZi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                                .addComponent(jLabel7)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(txtYf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(jPanel2Layout.createSequentialGroup()
                                                .addComponent(jLabel6)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(txtZf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(73, 73, 73)
                                        .addComponent(jLabel11))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(txtXf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel3)
                                        .addGap(14, 14, 14))))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtYi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel10)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jtxtSx)
                            .addComponent(jtxtSy)
                            .addComponent(jtxtSz, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtPassosTempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel9)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(txtMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnLocMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jChkVisivel)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel1)
                                .addComponent(txtXi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel8)
                                .addComponent(txtXf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jtxtSx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(12, 12, 12)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtxtSy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtYi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)
                            .addComponent(txtYf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtZi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jtxtSz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(txtZf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(txtPassosTempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnLocMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jChkVisivel))
                .addGap(82, 82, 82))
        );

        btnConfirmar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/confirmar.png"))); // NOI18N
        btnConfirmar.setText("Confirmar");
        btnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConfirmarActionPerformed(evt);
            }
        });

        btnLimpar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/limpar1.png"))); // NOI18N
        btnLimpar.setText("Limpar");
        btnLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLimparActionPerformed(evt);
            }
        });

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/Cancelar.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addContainerGap(202, Short.MAX_VALUE)
                        .addComponent(btnConfirmar, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnLimpar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCancelar)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnConfirmar)
                    .addComponent(btnLimpar)
                    .addComponent(btnCancelar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfirmarActionPerformed
// TODO add your handling code here:
    Geometria d = managementCore.getDominioComputacional();

    Geometria novoDominio;
    if (txtXi.getText().isEmpty() &&
            txtXf.getText().isEmpty() &&
            txtYi.getText().isEmpty() &&
            txtYf.getText().isEmpty() &&
            txtZi.getText().isEmpty() &&
            txtZf.getText().isEmpty() &&
            txtPassosTempo.getText().isEmpty()) {

        managementCore.getInterfaceServicos().exibirMensagemAlerta("Não deixe nenhum campo em branco.");

    } else {

        float[] firstPoint = new float[3];
        float[] secondPoint = new float[3];
        float[] reference = new float[3];
        
        firstPoint[0] = Float.valueOf(txtXi.getText());
        firstPoint[1] = Float.valueOf(txtYi.getText());
        firstPoint[2] = Float.valueOf(txtZi.getText());
        secondPoint[0] = Float.valueOf(txtXf.getText());
        secondPoint[1] = Float.valueOf(txtYf.getText());
        secondPoint[2] = Float.valueOf(txtZf.getText());
        
        int nsteps = Integer.valueOf(txtPassosTempo.getText());
        
        Vector camadasPML = new Vector();
        camadasPML = managementCore.getInterfaceServicos().getCamadasPML();
        
        int t = Integer.valueOf(camadasPML.get(0).toString());
        
        int sx = Integer.valueOf(jtxtSx.getText());
        int sy = Integer.valueOf(jtxtSy.getText());
        int sz = Integer.valueOf(jtxtSz.getText());
        //Material mTemp = managementCore.getInterfaceServicos().obterMaterial(d.getMaterial().getId());
        Material mTemp = material;
        AtributosGeometria atributos = new DominioComputacional(firstPoint, secondPoint,reference, 
                1, sx, sy, sz, 
                Integer.valueOf(camadasPML.get(0).toString()),Integer.valueOf(camadasPML.get(1).toString()), 
                Integer.valueOf(camadasPML.get(2).toString()), Integer.valueOf(camadasPML.get(3).toString()),
                Integer.valueOf(camadasPML.get(4).toString()), Integer.valueOf(camadasPML.get(5).toString()),
                "mm", nsteps);
        novoDominio = new Geometria(d.getIdentificador(), d.getNome(), atributos, jChkVisivel.isSelected(), false, mTemp, 0.0f, 0.0f, 0.0f);

        if (managementCore.verificaModificaoDominioComp(novoDominio)) {
            managementCore.setDominioComputacional(novoDominio);
            
            
            dispose();
        } else {
            managementCore.setDominioComputacional(d);
            managementCore.getInterfaceServicos().exibirMensagemAlerta("Fonte fora do domínio de simulação)");
        }

    }
}//GEN-LAST:event_btnConfirmarActionPerformed

private void btnLimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimparActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btnLimparActionPerformed

private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
// TODO add your handling code here:
    dispose();
}//GEN-LAST:event_btnCancelarActionPerformed

private void btnLocMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLocMaterialActionPerformed
// TODO add your handling code here:
    material = managementCore.getInterfaceServicos().setMaterial();
    if (material != null) {
        txtMaterial.setText(material.getNome());
    }


}//GEN-LAST:event_btnLocMaterialActionPerformed
    public Geometria getDominioComputacional() {
        return managementCore.getDominioComputacional();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnConfirmar;
    private javax.swing.JButton btnLimpar;
    private javax.swing.JButton btnLocMaterial;
    private javax.swing.JCheckBox jChkVisivel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField jtxtSx;
    private javax.swing.JTextField jtxtSy;
    private javax.swing.JTextField jtxtSz;
    private javax.swing.JTextField txtMaterial;
    private javax.swing.JTextField txtPassosTempo;
    private javax.swing.JTextField txtXf;
    private javax.swing.JTextField txtXi;
    private javax.swing.JTextField txtYf;
    private javax.swing.JTextField txtYi;
    private javax.swing.JTextField txtZf;
    private javax.swing.JTextField txtZi;
    // End of variables declaration//GEN-END:variables
    private Material material;
}

